package com.hsxc.cdz.monitor.bean.server.v1_33;

import com.hsxc.cdz.base.util.BytesUtil;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.ReferenceCountUtil;

/**
 * 
 * @author 刘力文
 * 服务端下发取消预约充电报文类
 *
 */
public class ReserveCeaseSerMsg extends ServerMessage {
	
	public static final int length = 11;
	private int port;         //充电口号
	private String cardNum;  //用户卡号
	
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	public String getCardNum() {
		return cardNum;
	}
	public void setCardNum(String cardNum) {
		this.cardNum = cardNum;
	}

	@Override
	public byte[] getBytesFromMessage() {
		ByteBuf bytes = Unpooled.buffer(ReserveCeaseSerMsg.length);
		byte[] result;
		byte[] temp;
		
		temp  = BytesUtil.intToBytesSeq(this.getPort(), 1);
		bytes.writeBytes(temp);
		
		temp  = BytesUtil.strToBcdBytes(this.getCardNum(), 10);
		bytes.writeBytes(temp);
		
		result = new byte[bytes.readableBytes()];
		bytes.readBytes(result);
		ReferenceCountUtil.release(bytes);
		return result;
	}

}
